package svgedit.svg;

/**
 * @author Ross
 * 
 */
public interface SVGElementInterface
{
	/**
	 * Returns the document the element belongs to.
	 * 
	 * @return SVGDocument
	 */
	public SVGDocument getDocument();

	/**
	 * Returns the root svg element the element belongs to. ie SVGDocument.root
	 * 
	 * @return SVGRootGroup
	 */
	public SVGRootGroup getRootGroup();

	/**
	 * Returns the ancestor of the element that is a child of the root group ie
	 * root->group1->group2->element If called on element returns group1
	 * 
	 * @return SVGGroup
	 */
	public SVGGroup getGodFatherGroup();

	/**
	 * Returns the parent of the element.
	 * 
	 * @return SVGGroup
	 */
	public SVGGroup getParent();

	/**
	 * Destroys the elements, by removing it from its parent. If the element is
	 * a group element its children are also destroyed. (Should be garbage
	 * collected)
	 */
	public void destroy();

	/**
	 * For debugging. Writes to console the element. If it is a group it writes
	 * all its children as well. Call on the RootGroup and it will write the
	 * entire document. Indents each level using spaces, starting with indent
	 * 
	 * @param indent
	 *            how many chars to start indenting from (>0)
	 */
	public void write(int indent);

}
